home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 August / ENTER.ISO / files / gimp-2.0.5-i586-setup.exe / {app} / share / gimp / 2.0 / scripts / beveled-pattern-hrule.scm < prev    next >
Encoding:
Text File  |  2004-09-26  |  2.7 KB  |  75 lines

  1. ; The GIMP -- an image manipulation program
  2. ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
  3. ;
  4. ; Beveled pattern hrule for web pages
  5. ; Copyright (C) 1997 Federico Mena Quintero
  6. ; federico@nuclecu.unam.mx
  7. ;
  8. ; This program is free software; you can redistribute it and/or modify
  9. ; it under the terms of the GNU General Public License as published by
  10. ; the Free Software Foundation; either version 2 of the License, or
  11. ; (at your option) any later version.
  12. ;
  13. ; This program is distributed in the hope that it will be useful,
  14. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16. ; GNU General Public License for more details.
  17. ;
  18. ; You should have received a copy of the GNU General Public License
  19. ; along with this program; if not, write to the Free Software
  20. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21.  
  22.  
  23. (define (script-fu-beveled-pattern-hrule width height pattern)
  24.   (let* ((old-bg-color (car (gimp-palette-get-background)))
  25.      (img (car (gimp-image-new width height RGB)))
  26.      (background (car (gimp-layer-new img width height RGB-IMAGE "Hrule" 100 NORMAL-MODE)))
  27.      (bumpmap (car (gimp-layer-new img width height RGBA-IMAGE "Bumpmap" 100 NORMAL-MODE))))
  28.     (gimp-image-undo-disable img)
  29.     (gimp-image-add-layer img background -1)
  30.     (gimp-image-add-layer img bumpmap -1)
  31.  
  32.     ; Create pattern layer
  33.  
  34.     (gimp-palette-set-background '(0 0 0))
  35.     (gimp-edit-fill background BACKGROUND-FILL)
  36.     (gimp-patterns-set-pattern pattern)
  37.     (gimp-edit-bucket-fill background PATTERN-BUCKET-FILL NORMAL-MODE 100 0 FALSE 0 0)
  38.  
  39.     ; Create bumpmap layer
  40.  
  41.     (gimp-edit-fill bumpmap BACKGROUND-FILL)
  42.  
  43.     (gimp-palette-set-background '(127 127 127))
  44.     (gimp-rect-select img 1 1 (- width 2) (- height 2) CHANNEL-OP-REPLACE FALSE 0)
  45.     (gimp-edit-fill bumpmap BACKGROUND-FILL)
  46.  
  47.     (gimp-palette-set-background '(255 255 255))
  48.     (gimp-rect-select img 2 2 (- width 4) (- height 4) CHANNEL-OP-REPLACE FALSE 0)
  49.     (gimp-edit-fill bumpmap BACKGROUND-FILL)
  50.  
  51.     (gimp-selection-none img)
  52.  
  53.     ; Bumpmap
  54.  
  55.     (plug-in-bump-map 1 img background bumpmap 135 45 2 0 0 0 0 TRUE FALSE 0)
  56.  
  57.     (gimp-image-set-active-layer img background)
  58.     (gimp-image-remove-layer img bumpmap)
  59.  
  60.     (gimp-palette-set-background old-bg-color)
  61.     (gimp-image-undo-enable img)
  62.     (gimp-display-new img)))
  63.  
  64.  
  65. (script-fu-register "script-fu-beveled-pattern-hrule"
  66.             _"<Toolbox>/Xtns/Script-Fu/Web Page Themes/Beveled Pattern/_Hrule..."
  67.             "Beveled pattern hrule"
  68.             "Federico Mena Quintero"
  69.             "Federico Mena Quintero"
  70.             "July 1997"
  71.             ""
  72.                     SF-ADJUSTMENT _"Width" '(480 5 1500 1 10 0 1)
  73.                     SF-ADJUSTMENT _"Height" '(16 1 100 1 10 0 1)
  74.             SF-PATTERN    _"Pattern" "Wood")
  75.